package store

import (
	"aggregation/store/postgres"
	"context"
	"time"
)

type ICounter interface {
	// Count 总量数据
	Count(ctx context.Context) (int64, error)
	// DayCount 获取单独一天的数据
	CountByRange(ctx context.Context, begin, end time.Time) (postgres.DurationCount, error)
	// ThirtyDaysCount 获取当前时间点所在月份一个月里面全部天数的的数据
	ThirtyDaysCount(ctx context.Context, month time.Time) (postgres.DurationCounts, error)
	// TwelveMonthsCount 获取当前时间节点所在年12个月全部数据
	TwelveMonthsCount(ctx context.Context, year time.Time) (postgres.DurationCounts, error)
	// FiveYearsCount 获取五年的数据
	FiveYearsCount(ctx context.Context, year time.Time) (postgres.DurationCounts, error)
}

// ICache 当天的数据不缓存
type ICache interface {
	AddOneDay(ctx context.Context, key time.Time, count int64) (int64, error)
	GetOneDay(ctx context.Context, key time.Time) (int64, error)
	// AddThirtyDays 添加一个月三十天的
	AddThirtyDays(ctx context.Context, key time.Time, counts []int64) (int64, error)
	GetThirtyDays(ctx context.Context, key time.Time) ([]int64, error)
	// AddTwelveMonths 用于添加多个月份，多个年份的数据
	AddTwelveMonths(ctx context.Context, key time.Time, counts []int64) (int64, error)
	GetTwelveMonths(ctx context.Context, key time.Time) ([]int64, error)

	AddFiveYears(ctx context.Context, key time.Time, counts []int64) (int64, error)
	GetFiveYears(ctx context.Context, key time.Time) ([]int64, error)
}

// 获取用户总量
type ITotal interface {
	GetTotal(ctx context.Context, key time.Time) (int64, error)
	AddTotal(ctx context.Context, key time.Time, count int64) error
}
